<!DOCTYPE>
<html>
<head>
  <meta charset="utf-8">
  <title>编辑用户</title>
  <link rel="stylesheet" href="../add/add.css">
  <style>
    .list-user{
      width: 120px;
      height:34px;
      background:#5377BB;
      border:1px solid #5377BB;
      border-radius:3px;
    }
  </style>
</head>
<body>
  <a href="../index/index.php">
    <button class="list-user">用户列表</button>
  </a>
    <?php
      header("Content-type:text/html;charset=utf-8");
      date_default_timezone_set("Asia/shanghai");
      $mysql = mysqli_connect("localhost","root","root","test");
      if(!$mysql){die("连接失败!".mysqli_error());}
      $id = $_GET['id'];
      $id = intval($id);
      $select = mysqli_query($mysql,"SELECT * FROM `user` WHERE id = $id");

      $row = mysqli_fetch_row($select);
      $row[4] = date("Y-m-d H:i:s",$row[4]);
    ?>
  <form action="../update.php" method="post">
    <p class="title-admin">编辑用户</p>
    <hr/>
    <input type="hidden" name="id" value="<?php echo $row[0] ?>">
    <div>
      <input type="text" placeholder="username" name="username" value="<?php echo $row[1] ?>" required/>
    </div>
    <div>
      <input type="password" placeholder="password" name="password" value="<?php echo $row[2] ?>" required/>
    </div>
    <div>
      <input type="text" placeholder="name" name="name" value="<?php echo $row[3] ?>" required/>
    </div>

    <div class="button-type">
      <button type="submit">修改</button>
      <button type="reset">重置</button>
    </div>
    <p style="margin-top:40px;margin-left:200px;">用户注册时间: <?php echo $row[4] ?></p>
  </form>
</body>
</html>
